/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package warmachineroster.impl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import warmachineroster.Roster;
import warmachineroster.RosterElement;
import warmachineroster.UnitRosterElement;
import warmachineroster.WarcasterRosterElement;
import warmachineroster.WarjackRosterElement;
import warmachineroster.WarmachinerosterFactory;
import warmachineroster.WarmachinerosterPackage;

import warmachinesystem.WarmachineSystemPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class WarmachinerosterPackageImpl extends EPackageImpl implements WarmachinerosterPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass rosterEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass rosterElementEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass unitRosterElementEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass warcasterRosterElementEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass warjackRosterElementEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see warmachineroster.WarmachinerosterPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private WarmachinerosterPackageImpl() {
		super(eNS_URI, WarmachinerosterFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link WarmachinerosterPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static WarmachinerosterPackage init() {
		if (isInited) return (WarmachinerosterPackage)EPackage.Registry.INSTANCE.getEPackage(WarmachinerosterPackage.eNS_URI);

		// Obtain or create and register package
		WarmachinerosterPackageImpl theWarmachinerosterPackage = (WarmachinerosterPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof WarmachinerosterPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new WarmachinerosterPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		WarmachineSystemPackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theWarmachinerosterPackage.createPackageContents();

		// Initialize created meta-data
		theWarmachinerosterPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theWarmachinerosterPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(WarmachinerosterPackage.eNS_URI, theWarmachinerosterPackage);
		return theWarmachinerosterPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRoster() {
		return rosterEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getRoster_ArmyList() {
		return (EReference)rosterEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getRoster_RosterUnits() {
		return (EReference)rosterEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRoster_Name() {
		return (EAttribute)rosterEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRoster_PointValue() {
		return (EAttribute)rosterEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getRoster_MaxPointValue() {
		return (EAttribute)rosterEClass.getEStructuralFeatures().get(4);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRosterElement() {
		return rosterElementEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getRosterElement_UnitType() {
		return (EReference)rosterElementEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getUnitRosterElement() {
		return unitRosterElementEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getUnitRosterElement_UnitAttachment() {
		return (EReference)unitRosterElementEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getUnitRosterElement_ModelCount() {
		return (EAttribute)unitRosterElementEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getWarcasterRosterElement() {
		return warcasterRosterElementEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getWarcasterRosterElement_Battlegroup() {
		return (EReference)warcasterRosterElementEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getWarjackRosterElement() {
		return warjackRosterElementEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getWarjackRosterElement_MainUnit() {
		return (EReference)warjackRosterElementEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WarmachinerosterFactory getWarmachinerosterFactory() {
		return (WarmachinerosterFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		rosterEClass = createEClass(ROSTER);
		createEReference(rosterEClass, ROSTER__ARMY_LIST);
		createEReference(rosterEClass, ROSTER__ROSTER_UNITS);
		createEAttribute(rosterEClass, ROSTER__NAME);
		createEAttribute(rosterEClass, ROSTER__POINT_VALUE);
		createEAttribute(rosterEClass, ROSTER__MAX_POINT_VALUE);

		rosterElementEClass = createEClass(ROSTER_ELEMENT);
		createEReference(rosterElementEClass, ROSTER_ELEMENT__UNIT_TYPE);

		unitRosterElementEClass = createEClass(UNIT_ROSTER_ELEMENT);
		createEReference(unitRosterElementEClass, UNIT_ROSTER_ELEMENT__UNIT_ATTACHMENT);
		createEAttribute(unitRosterElementEClass, UNIT_ROSTER_ELEMENT__MODEL_COUNT);

		warcasterRosterElementEClass = createEClass(WARCASTER_ROSTER_ELEMENT);
		createEReference(warcasterRosterElementEClass, WARCASTER_ROSTER_ELEMENT__BATTLEGROUP);

		warjackRosterElementEClass = createEClass(WARJACK_ROSTER_ELEMENT);
		createEReference(warjackRosterElementEClass, WARJACK_ROSTER_ELEMENT__MAIN_UNIT);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		WarmachineSystemPackage theWarmachineSystemPackage = (WarmachineSystemPackage)EPackage.Registry.INSTANCE.getEPackage(WarmachineSystemPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		unitRosterElementEClass.getESuperTypes().add(this.getRosterElement());
		warcasterRosterElementEClass.getESuperTypes().add(this.getRosterElement());
		warjackRosterElementEClass.getESuperTypes().add(this.getRosterElement());

		// Initialize classes and features; add operations and parameters
		initEClass(rosterEClass, Roster.class, "Roster", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getRoster_ArmyList(), theWarmachineSystemPackage.getArmyList(), null, "armyList", null, 1, 1, Roster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getRoster_RosterUnits(), this.getRosterElement(), null, "rosterUnits", null, 0, -1, Roster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getRoster_Name(), ecorePackage.getEString(), "name", null, 0, 1, Roster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getRoster_PointValue(), ecorePackage.getEInt(), "pointValue", null, 0, 1, Roster.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, IS_DERIVED, IS_ORDERED);
		initEAttribute(getRoster_MaxPointValue(), ecorePackage.getEInt(), "maxPointValue", null, 0, 1, Roster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		EOperation op = addEOperation(rosterEClass, ecorePackage.getEBoolean(), "canAdd", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, theWarmachineSystemPackage.getBaseUnit(), "baseUnit", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(rosterElementEClass, RosterElement.class, "RosterElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getRosterElement_UnitType(), theWarmachineSystemPackage.getBaseUnit(), null, "unitType", null, 0, 1, RosterElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		addEOperation(rosterElementEClass, ecorePackage.getEInt(), "getPointCost", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(unitRosterElementEClass, UnitRosterElement.class, "UnitRosterElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getUnitRosterElement_UnitAttachment(), this.getRosterElement(), null, "unitAttachment", null, 0, -1, UnitRosterElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getUnitRosterElement_ModelCount(), ecorePackage.getEInt(), "modelCount", null, 0, 1, UnitRosterElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(warcasterRosterElementEClass, WarcasterRosterElement.class, "WarcasterRosterElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getWarcasterRosterElement_Battlegroup(), this.getWarjackRosterElement(), null, "battlegroup", null, 0, -1, WarcasterRosterElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(warjackRosterElementEClass, WarjackRosterElement.class, "WarjackRosterElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getWarjackRosterElement_MainUnit(), this.getRosterElement(), null, "mainUnit", null, 0, 1, WarjackRosterElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Create resource
		createResource(eNS_URI);
	}

} //WarmachinerosterPackageImpl
